﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Mbr.Reviews.Core.Contracts.DTO
{
    public static class Extensions
    {
        public static bool IsMatch(this Product product, params string[] keywords)
        {
            return keywords.Any(k =>
                product.Name.ToLowerInvariant().Contains(k.ToLowerInvariant())
                || product.Description.ToLowerInvariant().Contains(k.ToLowerInvariant())
                || product.Tags.Any(t => t.ToLowerInvariant().Contains(k.ToLowerInvariant()))
                );
        }
    }
}
